//------------Sonic CD BGEffects Script-------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

//-------Aliases-------//
#alias 16: TYPE_BGEFFECTS


sub ObjectDraw
	TempValue0=TileLayer[0].Angle
	TempValue0-=Object.Value1
	if TempValue0>255
		TempValue1=512
		TempValue1-=TempValue0
		TempValue0=TempValue1
	else
		if TempValue0<-255
			TempValue1=-512
			TempValue1-=TempValue0
			TempValue0=TempValue1
		endif
	endif
	TempValue0<<=1
	TempValue0%=237
	Object.Value0+=TempValue0
	if Object.Value0>0
		Object.Value0-=237
	else
		if Object.Value0<-236
			Object.Value0+=237
		endif
	endif
	Object.Value1=TileLayer[0].Angle
	TempValue0=Object.Value0
	TempValue1=0
	while TempValue1<Screen.YSize
		TempValue2=TempValue0
		while TempValue2<Screen.XSize
			DrawSpriteScreenXY(0,TempValue2,TempValue1)
			TempValue2+=237
		loop
		TempValue1+=196
	loop
endsub


sub ObjectStartup
	SetMusicTrack("SS7.ogg",0,1)
	SetMusicTrack("SS7Finish.ogg",1,0)
	Stage.XBoundary1=67108864
	Stage.XBoundary2=201326592
	Stage.YBoundary1=67108864
	Stage.YBoundary2=201326592
#platform: HW_Rendering
	LoadSpriteSheet("Special/SSMap7.gif")
#endplatform
	LoadSpriteSheet("Special/ss7bg.gif")
	SpriteFrame(0,0,237,196,0,0)
	ArrayPos0=32
	while ArrayPos0<1056
		if Object[ArrayPos0].Type==TypeName[BGEffects]
			Object[ArrayPos0].Priority=1
			Object[ArrayPos0].DrawOrder=0
		endif
		ArrayPos0++
	loop
endsub

sub RSDK
	LoadSpriteSheet("Global/Display.gif")
	SetEditorIcon(Icon0,SingleIcon,-16,-16,32,32,1,143)
endsub
